{% extends "base.html" %}
{% load static %}

{% block title%}Dashboard - {{ block.super }}{% endblock %}
{% block navbar_title%}
    Dashboard
    <button type="button" class="btn btn-default btn-sm" data-toggle="modal" data-target="#modal-add-widget"><i class="fa fa-plus"></i></button>
    <button type="button" class="btn btn-default btn-sm" id="save-dashboard"><i class="fa fa-save"></i></button>
{% endblock %}

{% block content %}

<section class="content">

    <div class="row">
        <div class="col-md-12">
            {% include "messages.html" %}
        </div>

        <div class="col-md-12">
            <div class="grid-stack"></div>
        </div>
    </div>

</section>

<div class="modal fade" id="modal-add-widget">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title">Add a widget</h4>
            </div>
            <div class="modal-body">
                <ul class="products-list product-list-in-box widgets-list">
                    {% for widget in widgets %}
                    <li class="item">
                      <div class="product-img">
                        {% with "img/widgets/"|add:widget.type|add:".png" as image %}
                        <img src="{% static image %}" alt="Product Image">
                        {% endwith %}
                      </div>
                      <div class="product-info">
                        <strong class="product-title">{{ widget.name }}
                            <span class="pull-right"><button class="btn btn-default btn-sm add-widget" data-type="{{ widget.type }}">Add widget</button></span>
                        </strong>
                        <span class="product-description">{{ widget.description }}</span>
                      </div>
                    </li>
                    {% endfor %}
                </ul>
            </div>
        </div>
    </div>
</div>

{% endblock %}
